import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class VirtualThreadUtil {
    static void testCostTime() {
        long start = System.currentTimeMillis();
        ExecutorService es = Executors.newVirtualThreadPerTaskExecutor();
        for (int i = 0; i < 100000; i++) {
            es.submit(() -> {
               Thread.sleep(1000);
               return 0;
            });
        }
        es.close();
        long end = System.currentTimeMillis();
        System.out.println("cost time: " + (end - start) + "ms");
    }
}
